package com.yunji.storage.mapper;

import com.github.yulichang.base.MPJBaseMapper;
import com.yunji.storage.domain.StockTakeInfoDO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;


/**
 * @Package com.yunji.storage.mapper
 * FileName:	StockTakeInfoMapper.java
 * Copyright:	Copyright © 2024 All Rights Reserved
 * Company:		云集互联
 * @version: 1.0
 * @since: JDK 1.8.0_202
 * Create at:   2024-08-30 10:02:31.631
 * Description:
 * 盘点详情表数据交互
 * Modification History:
 * Author					Date						Version			Description
 * --------------------------------------------------------------------------------
 * HuaAo				2024-08-30 10:02:31			1.0				1.0 Version
 */
public interface StockTakeInfoMapper extends MPJBaseMapper<StockTakeInfoDO> {

    @Select("<script>  UPDATE " +
            "        v3_stocktake_info" +
            "        SET" +
            "        actual_quantity = null," +
            "        stocktake_deviate = null," +
            "        stocktake_result = null," +
            "        <if test=\"bean.updater != null\">updater = #{bean.updater},</if>" +
            "        <if test=\"bean.updateName != null\">update_name = #{bean.updateName},</if>" +
            "        <if test=\"bean.updateTime != null\">update_time = #{bean.updateTime}</if>" +
            "        WHERE" +
            "        del_flag = 0" +
            "        <foreach item=\"infoId\" collection=\"infoIds\" open=\" AND info_id IN (\" separator=\",\" close=\")\">" +
            "            #{infoId}" +
            "        </foreach></script>")
    int cleanData(@Param("bean") StockTakeInfoDO stockTakeInfo, @Param("infoIds") Long... infoIds);
}
